package com.yxc.elasticsearchdemo.entiey;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDateTime;

/**
 * 测试esFieldType类型的实体类
 *
 * @author: YXC
 * @time: 2022/11/30 16:03
 **/
@Data
@Document(indexName = "field-type-test")
@AllArgsConstructor
@NoArgsConstructor
public class FieldTypeTestEntity {

    @Field(value = "start_time", type = FieldType.Date, format = {DateFormat.date_hour_minute_second_fraction,
            DateFormat.epoch_millis})
    private LocalDateTime startTime;

    @Field(value = "date_str", type = FieldType.Keyword, index = true)
    private String dateStr;

}
